package com.cennavi.minemapdemo.offline;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lijingru on 2019/7/2.
 */

public class OfflinDownItem {

    private int type;// 显示类型
    private boolean isExpand;// 是否展开
    private List<OfflinDownItem> childBean;
    private String ID;
    private String name;
    private String info;
    private long size;
    private long downloadSize;
    private int state;
    private int zoneCode;//MineNavi 数据 使用这个下载
    private int prNumber;
    private String dataId;//MineMap 数据 使用这个下载
    private boolean isUpdate;//是否有更新

    public OfflinDownItem(){

    }
    public OfflinDownItem(String name, int type) {
        this.name = name;
        this.type = type;

    }

    public int getPrNumber() {
        return prNumber;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public boolean isExpand() {
        return isExpand;
    }

    public void setExpand(boolean expand) {
        isExpand = expand;
    }

    public List<OfflinDownItem> getChildBean() {
        return childBean;
    }

    public void setChildBean(List<OfflinDownItem> childBean) {
        this.childBean = childBean;
    }
    public void addChildBean(OfflinDownItem one){
        if (this.childBean ==  null){
            this.childBean = new ArrayList<>();
        }
        this.childBean.add(one);
    }
    public void clearChildBean(){
        if (this.childBean !=  null){
            this.childBean.clear();
        }
        this.childBean = null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        if (this.name.equals("基础数据")){
            this.info = "离线数据必备包";
        }
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }



    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public long getDownloadSize() {
        return downloadSize;
    }

    public void setDownloadSize(long downloadSize) {
        this.downloadSize = downloadSize;
        prNumber = (int) (downloadSize*100.0/size);
//        prNumber = new java.text.DecimalFormat("#0.1").format(progress);
    }

    public int getZoneCode() {
        return zoneCode;
    }

    public void setZoneCode(int zoneCode) {
        this.zoneCode = zoneCode;
    }

    public String getDataId() {
        return dataId;
    }

    public void setDataId(String dataId) {
        this.dataId = dataId;
    }

    public boolean isUpdate() {
        return isUpdate;
    }

    public void setUpdate(boolean update) {
        isUpdate = update;
    }
}
